#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<stdbool.h>
bool involvenine(int n)
{
    int flag = 0;
    while (n)
    {
        if (n % 10 == 9)
        {
            flag = 1;
        }
        n /= 10;
    }
    if (flag)
    {
        return true;
    }
    else {
        return false;
    }
}
int main()
{
    int count = 0;
    for (int i = 1; i <= 2019; i++)
    {
        if (involvenine(i))
        {
            count++;
        }
    }
    printf("%d\n", count);

    return 0;
}